﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Timers;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

namespace Emoney.UserTraining.Admin
{
    // 注意: 有关启用 IIS6 或 IIS7 经典模式的说明，
    // 请访问 http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            ThreadFunMtgID(null, null);
            //三十分钟执行一次 30 * 60
            Timer timer = new Timer(30 * 60 * 1000);
            timer.Elapsed += new ElapsedEventHandler(ThreadFunMtgID);
            timer.Start();
        }
        BLL.Traning_NetworkMeetingBLL bll = new BLL.Traning_NetworkMeetingBLL();
        public void ThreadFunMtgID(object obj, System.Timers.ElapsedEventArgs args)
        {
            string str = bll.ThreadFunMtgID();
            if (str != "")
            {
                if (System.DateTime.Now.Hour > 8 && System.DateTime.Now.Hour < 20)
                {
                    //mail.mail ma = new web_PlaceReserve.mail.mail();
                    //ma.SendMail("395997250@qq.com", "网络会场出现问题", str);
                    //ma.SendMail("jiangwei@emoney.cn", "网络会场出现问题", str);
                }
            }
        }
    }
}